//@charset "utf-8"
$(function(){
(async()=>{
	//初始大小

    //获取客户端声音
	try {
		var clientInterface = new ComClientInterface();
    	clientInterface.modifyWindowsSize('442','416','Center');

		var code = getUrlParam('code');
		var market = getUrlParam('market');
		$('#view_stock_input').attr('data-market', market);
		if(code === ''){
			await hqQuote.request(condition.render, '17:600000', 'now', '600000');
		}else{
			var mCode = market+':'+code;
			$("#view_stock_input").val(code);
			//console.log($('#view_stock_input').val()+"condition.bindEvent");
			await hqQuote.request(condition.render, mCode, 'now', code);
			
			condition.bindEvent();
		}

		stockInput.bindEvent();
		//console.log($('#view_stock_input').val()+"stockInput.bindEvent");
	} catch (exp) {
		alert(exp.message);
	}

	$("#wencai").on('click',async function(){
		var stockcode = $("#view_stock_input").val().substring(0,6);
		await clientInterface.openAskEarlyWebDlg("stockcode="+stockcode);
	});
})();
});

//获取预警信息
	//var clientInterface = new ComClientInterface();
	//var subscribeDataStr = await clientInterface.getSubData();
/*	var modestr = await clientInterface.getDefaultAlertMode();
	setTimeout(function () {

		var arrmode_m = modestr.split(",");
		//alert('获取之前的'+arrmode_m);
		if(modestr != ''){
			if(arrmode_m[0] == 1){
				$("#keep_monitor").addClass("c-on");
			}else{
				$("#keep_monitor").removeClass("c-on");
			}
			if(arrmode_m[1] == 1){
				$("#show_pop").addClass("c-on");
			}else{
				$("#show_pop").removeClass("c-on");
			}
			if(arrmode_m[5] == 1){
				$("#keep_iphone").addClass("c-on");
			}else{
				$("#keep_iphone").removeClass("c-on");
			}
			if(arrmode_m[2] == 1){
				if(arrmode_m[4] == 'alert'){
					$("#soundid").find('[value="alert"]').get(0).selected = true;
				}else if(arrmode_m[4] == 'up'){
					$("#soundid").find('[value="up"]').get(0).selected = true;
				}else if(arrmode_m[4] == '清脆'){
					$("#soundid").find('[value="清脆"]').get(0).selected = true;
				}

			}else{
				$("#show_sounds").removeClass("c-on");
				$("#soundid").hide();

			}
		}*/

		/*if (subscribeDataStr != '') {

			var subscribeData = eval("data="+subscribeDataStr);
	        var length = subscribeData.length;
	        for(var i=0; i<length; i++){
	        	var stockcode = subscribeData[i]['datainfo']['stockcode'];
	        	if(code == stockcode){
	        		var pcid = subscribeData[i]['pcid'];
	        		var mobileid = subscribeData[i]['mobileid'];
	        		var platform = subscribeData[i]['platform'];
	        		var appname = subscribeData[i]['appname'];
	        		var templates = subscribeData[i]['datainfo']['templates'];
	        		var value = subscribeData[i]['datainfo']['value'];
	        		var mode = subscribeData[i]['datainfo']['mode'];
	        		var arrmode = mode.split(",");
	        		var stockname = subscribeData[i]['datainfo']['stockname'];
	        		$("#view_stock_input").val(code+' '+stockname);
	        		if(templates == 'a'){
	        			$("#view_price_up_input").attr('pcid',pcid);
	    				$("#view_price_up_input").val(value);
						$("#view_price_up").click();
		    			$("#view_price_up").addClass("c-on");
	        		}
	        		if(templates == 'b'){
	        			$("#view_price_down_input").attr('pcid',pcid);
	        			$("#view_price_down_input").val(value);
	        			$("#view_price_down").click();
	        			$("#view_price_down").addClass("c-on");
	        		}

	        		if(templates == 'c'){
	        			$("#view_day_zhangdiefu_input").attr('pcid',pcid);
	        			$("#view_day_zhangdiefu_input").val(value);
	        			$("#view_day_zhangdiefu").click();
	        			$("#view_day_zhangdiefu").addClass("c-on");
	        		}
	        		if(templates == 'd'){
	        			$("#view_day_zhangdiefu_input").attr('pcidd',pcid);
	        			$("#view_day_zhangdiefu_input").val(value);
	        			$("#view_day_zhangdiefu").click();
	        			$("#view_day_zhangdiefu").addClass("c-on");
	        		}
	        		if(templates == 'e'){
	        			$("#view_fivemin_zhangdiefu_input").attr('pcid',pcid);
	        			$("#view_fivemin_zhangdiefu_input").val(value);
	        			$("#view_fivemin_zhangdiefu").click();
	        			$("#view_fivemin_zhangdiefu").addClass("c-on");
	        		}
	        		if(templates == 'f'){
	        			$("#view_fivemin_zhangdiefu_input").attr('pcidd',pcid);
	        			$("#view_fivemin_zhangdiefu_input").val(value);
	        			$("#view_fivemin_zhangdiefu").click();
	        			$("#view_fivemin_zhangdiefu").addClass("c-on");
	        		}
	        		if(templates == 'g'){
	        			$("#view_gonggao_input").attr('pcid',pcid);
	        			$("#view_gonggao").click();
	        			$("#view_gonggao").addClass("c-on");
	        		}
	        		if(templates == 'h'){
	        			$("#view_huanshoulv_input").attr('pcid',pcid);
	        			$("#view_huanshoulv_input").val(value);
	        			$("#view_huanshoulv").click();
	        			$("#view_huanshoulv").addClass("c-on");
	        		}
	        		if(templates == 'i'){
	        			$("#view_one_chengjiaoliang_input").attr('pcid',pcid);
	        			$("#view_one_chengjiaoliang_input").val(value);
	        			$("#view_one_chengjiaoliang").click();
	        			$("#view_one_chengjiaoliang").addClass("c-on");
	        		}
	        		if(arrmode[0] == 1){
	        			$("#keep_monitor").addClass("c-on");
	        		}else{
	        			$("#keep_monitor").removeClass("c-on");
	        		}
	        		if(arrmode[1] == 1){
	        			$("#show_pop").addClass("c-on");
	        		}else{
	        			$("#show_pop").removeClass("c-on");
	        		}
	        		if(arrmode[2] == 1){
	        			if(arrmode[4] == 'alert'){
							$("#soundid").find('[value="alert"]').get(0).selected = true;
						}else if(arrmode[4] == 'up'){
							$("#soundid").find('[value="up"]').get(0).selected = true;
						}else if(arrmode[4] == '清脆'){
							$("#soundid").find('[value="清脆"]').get(0).selected = true;
						}
	        		}else{
	        			$("#show_sounds").removeClass("c-on");
	        			$("#soundid").hide();

	        		}
	        	}
	        }
		}*/
	/*}, 100);*/

